//
//  UITextField+LYAdd.h
//  LYDevelopKit
//
//  Created by 李阳 on 2018/5/25.
//

#import <UIKit/UIKit.h>

/// 输入限制类型
typedef NS_ENUM(NSInteger, LYRestrictType)
{
    LYRestrictTypeFreedom = 0, ///< 不限制输入
    LYRestrictTypeOnlyNumber, ///< 只允许输入数字
    LYRestrictTypeOnlyDecimal, ///< 只允许输入实数，包括.
    LYRestrictTypeOnlyCharacter, ///< 只允许非中文输入
    LYRestrictTypeOnlyEmoji, ///< 只允许输入emoji表情
    LYRestrictTypeExceptEmoji ///< 限制输入emoji表情
};

@interface UITextField (LYAdd)

/// 当达到最大长度时的block
- (void)setBlockOnBreakMaxLength:(void (^)(UITextField *textField))block;
/// 输入限制类型的字符时的block
- (void)setBlockOnBreakRestrict:(void (^)(UITextField *textField))block;
/// 文字改变的回调
- (void)setBlockOnEditingChanged:(void(^)(NSString *text))block;

/// 限制类型
@property (nonatomic, assign)LYRestrictType restrictType;
/// 文本最长长度
@property (nonatomic, assign) NSUInteger maxTextLength;

@end

@interface UITextField (Placeholder)
/// 占位文字颜色
@property (nonatomic, strong)UIColor *placeholderColor;
/// 占位文字字体
@property (nonatomic, strong)UIFont *placeholderFont;
@end

